package com.zzt.mybatis.plus.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zzt.mybatis.plus.model.Userinfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description
 * User: panda
 * Date: 2025-03-21
 * Time: 14:30
 */
@Mapper
public interface UserInfoMapper extends BaseMapper<Userinfo> {

    @Select("select * from user_info where id = #{id}")
    Userinfo selectById2(Integer id);

    Userinfo selectById3(Integer id);

    @Select("select id,username,password,age from user_info ${ew.customSqlSegment}")
    List<Userinfo> selectUserInfoByCondition(@Param(Constants.WRAPPER) Wrapper<Userinfo> queryWrapper);

    @Update("update user_info set age = age + #{addAge} ${ew.customSqlSegment}")
    Integer updateById2(Integer addAge, @Param(Constants.WRAPPER) Wrapper<Userinfo> queryWrapper);

}
